package com.wufan.day02;

/**
 * @author SongWufan
 * @date 2021/3/5 15:39
 */
public class ArrayExec1 {
    public static void main(String[] args) {
        String[] arr = new String[]{"JJ","DD","MM","BB","GG","AA"};

        //数组的反转
        //方法一：
//        for (int i = 0; i < arr.length / 2; i++){
//            String temp = arr[i];
//            arr[i] = arr[arr.length - i - 1];
//            arr[arr.length - i - 1] = temp;
//        }
        for (int i = 0,j = arr.length - 1; i < j; i++,j--){
            String temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
        //遍历
        for (int i = 0; i < arr.length; i++){
            System.out.print(arr[i] + "\t");
        }

    }
}
